import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { PipePointInfoType } from '../gis/type'
export class LedgerApi {
  //查询截止点设施台账列表
  async GetLedgerEndList(params: any): Promise<TableIResponse<PipePointInfoType[]>> {
    const result = (await service.get('/api/patrol/facilityLedger/endList', {
      params
    })) as unknown as any
    return result
  }
  //查询红线内设施台账列表
  async GetLedgerRedList(params: any): Promise<TableIResponse<PipePointInfoType[]>> {
    const result = (await service.get('/api/patrol/facilityLedger/redList', {
      params
    })) as unknown as any
    return result
  }
  //删除设备设施台账
  async DeletLedger(uuids: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/facilityLedger/${uuids}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增设备设施台账
  async AddFacilityLedger(data: PipePointInfoType): Promise<boolean> {
    const result = (await service.post('/api/patrol/facilityLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改设备设施台账
  async EditFacilityLedger(data: PipePointInfoType): Promise<boolean> {
    const result = (await service.put('/api/patrol/facilityLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new LedgerApi()
